<%@ page contentType="text/html;charset=UTF-8" language="java" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<div class="investment" style="width:1100px;">
    <form id="pageForm" action="<c:url value="/borrow/index"/>">
        <input type="hidden" name="pageCurrent" id="pageCurrent" value="${borrowForm.pageCurrent}">
    </form>
    <div>
        <div>
            <ul class="choice">
                <li class="choice_on">
                    <span>标的类型：</span>
                    <c:choose>
                        <c:when test="${borrowForm.type eq 1}">
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="1"/><c:param name="deadline" value="${borrowForm.deadline}"/></c:url>" class="choice-items selected">全部</a>
                        </c:when>
                        <c:otherwise>
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="1"/><c:param name="deadline" value="${borrowForm.deadline}"/></c:url>" class="choice-items">全部</a>
                        </c:otherwise>
                    </c:choose>
                    <c:choose>
                        <c:when test="${borrowForm.type eq 2}">
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="2"/><c:param name="deadline" value="${borrowForm.deadline}"/></c:url>" class="choice-items selected">以租代购</a>
                        </c:when>
                        <c:otherwise>
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="2"/><c:param name="deadline" value="${borrowForm.deadline}"/></c:url>" class="choice-items">以租代购</a>
                        </c:otherwise>
                    </c:choose>
                    <c:choose>
                        <c:when test="${borrowForm.type eq 3}">
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="3"/><c:param name="deadline" value="${borrowForm.deadline}"/></c:url>" class="choice-items selected">汽车抵押</a>
                        </c:when>
                        <c:otherwise>
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="3"/><c:param name="deadline" value="${borrowForm.deadline}"/></c:url>" class="choice-items">汽车抵押</a>
                        </c:otherwise>
                    </c:choose>
                </li>
                <li class="choice_on">
                    <span>借款期限：</span>
                    <c:choose>
                        <c:when test="${borrowForm.deadline eq 1}">
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="${borrowForm.type}"/><c:param name="deadline" value="1"/></c:url>" class="choice-items selected">0~3月</a>
                        </c:when>
                        <c:otherwise>
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="${borrowForm.type}"/><c:param name="deadline" value="1"/></c:url>" class="choice-items">0~3月</a>
                        </c:otherwise>
                    </c:choose>
                    <c:choose>
                        <c:when test="${borrowForm.deadline eq 2}">
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="${borrowForm.type}"/><c:param name="deadline" value="2"/></c:url>" class="choice-items selected">3~6月</a>
                        </c:when>
                        <c:otherwise>
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="${borrowForm.type}"/><c:param name="deadline" value="2"/></c:url>" class="choice-items">3~6月</a>
                        </c:otherwise>
                    </c:choose>
                    <c:choose>
                        <c:when test="${borrowForm.deadline eq 3}">
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="${borrowForm.type}"/><c:param name="deadline" value="3"/></c:url>" class="choice-items selected">6~9月</a>
                        </c:when>
                        <c:otherwise>
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="${borrowForm.type}"/><c:param name="deadline" value="3"/></c:url>" class="choice-items">6~9月</a>
                        </c:otherwise>
                    </c:choose>
                    <c:choose>
                        <c:when test="${borrowForm.deadline eq 4}">
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="${borrowForm.type}"/><c:param name="deadline" value="4"/></c:url>" class="choice-items selected">9~12月</a>
                        </c:when>
                        <c:otherwise>
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="${borrowForm.type}"/><c:param name="deadline" value="4"/></c:url>" class="choice-items">9~12月</a>
                        </c:otherwise>
                    </c:choose>
                    <c:choose>
                        <c:when test="${borrowForm.deadline eq 5}">
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="${borrowForm.type}"/><c:param name="deadline" value="5"/></c:url>" class="choice-items selected">12月以上</a>
                        </c:when>
                        <c:otherwise>
                            <a href="<c:url value="/borrow/index"><c:param name="type" value="${borrowForm.type}"/><c:param name="deadline" value="5"/></c:url>" class="choice-items">12月以上</a>
                        </c:otherwise>
                    </c:choose>
                </li>
            </ul>
        </div>
        <div></div>
    </div>
    <div style="clear: left;">
        <style type="text/css">
            .income {
                color: rgb(255, 86, 86);
                animation: income 1.2s;
            }
        </style>
        <div class="biaodi_list">
            <div>
                <a href="#">借款标</a>
                <a href="#">定投宝</a>
            </div>
            <table>
                <tr>
                    <th style="text-align: left;">融资金额（元）</th>
                    <th style="width: 88px;">年化收益</th>
                    <th>还款期限</th>
                    <th>可投资金额（元）</th>
                    <th>进度</th>
                    <th>状态</th>
                </tr>
                <c:forEach items="${borrowInfos.content}" var="obj">
                    <tr>
                        <td class="biaodi_list_title">
                            <p><a href="#">${obj.name}</a></p>
                            <fmt:formatNumber value="${obj.totalMoney}" type="CURRENCY"/>
                        </td>
                        <td class="income" align="center"><fmt:formatNumber value="${obj.investRate / 100}" type="PERCENT"/></td>
                        <td align="center">${obj.period}月</td>
                        <td align="center"><fmt:formatNumber value="${obj.totalMoney - obj.investMoney}" type="CURRENCY"/></td>
                        <td class="biaodijindu" align="center">
                            <fmt:formatNumber value="${obj.investMoney / obj.totalMoney}" type="PERCENT"/>
                            <div style="width: 220px;height: 10px;background-color: #d0d0d0;text-align: left;border-radius: 5px;">
                                <div style="width: <fmt:formatNumber value="${(obj.totalMoney = obj.investMoney) / 100}" type="PERCENT"/>;height: 10px;background-color: #cca347;border-radius: 5px;"></div>
                            </div>
                        </td>
                        <td>
                            <a href="<c:url value="/borrow/detail/id/${obj.id}"/>" target="_blank">
                                <fmt:message key="${obj.status}"/>
                            </a>
                        </td>
                    </tr>
                </c:forEach>
            </table>
            <div style="align-content: center;height: 20px;">
                <div id="borrowPage"></div>
            </div>
        </div>
        <div style="height: 10px;"></div>
        <script type="text/javascript">
            $(document).ready(function(){
                $("#borrowPage").jqPaginator({
                    totalPages:${borrowInfos.totalPages},
                    currentPage:${borrowInfos.number+1},
                    page:'<li><a href="">{{page}}</a></li>'
                });
            });
        </script>
    </div>
</div>
